#include <iostream>
#include <algorithm>
#include "reopen"
using namespace std;


int main(void){
	reopen("P1094_t");
	int w,n,total=0;
	int a[30005];
	cin>>w>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	int l=0,h=n-1;
	for(;l!=h;l++){
		for(int i=h;i!=l;i--){
				if(a[l]+a[i]<=w){
					total+=1;
					h--;
					goto end;
				}
			}
		total+=h-l+1;
		break;
		end:
		if(l==h){
			total++;
			break;
		}
	}
	cout<<1234;
	cout<<total;
	return 0;
}